/*
Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:

Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].

来源：力扣（LeetCode）
链接：https://leetcode-cn.com/problems/two-sum
著作权归领扣网络所有。商业转载请联系官方授权，非商业转载请注明出处。
*/

#include <vector>

class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        int nSize = nums.size();
        int num1 = 0;
        int num2 = 0;

        for (int i = 0; i < nSize; i++)
        {
            for (int j = i+1; j < nSize; j++)
            {
                if (nums[i] + nums[j] == target)
                {
                    num1 = i;
                    num2 = j;
                }
            }
        }
        
        vector<int> vecRet;
        
        vecRet.push_back(num1);
        vecRet.push_back(num2);

        return vecRet;
    }
};